<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>host</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : 08/04/2005</div>
    <p>
      <b>host</b> -  Unix or DOS command execution</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>stat=host(command-name)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>command-name</b>
        </tt>: A character string containing Unix sh instruction</li>
      <li>
        <tt>
          <b>stat</b>
        </tt>: An integer flag</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    Sends a string <tt>
        <b>command-name</b>
      </tt> to Unix for execution by the command interpreter (sh under Unix, or command.com under DOS). Standard output and standard errors of the shell command are written in the calling shell.
    <tt>
        <b>stat</b>
      </tt> gives -1 if host can't be called (Not enough system memory
    available) or the command interpreter return code.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

    //create a getdir function based on host
    function wd=getdir()
      if MSDOS then 
        host('cd&gt;'+TMPDIR+'\path');
      else
        host('pwd&gt;'+TMPDIR+'/path');
      end
      wd=read(TMPDIR+'/path',1,1,'(a)')
    endfunction
    //call it
    wd=getdir()
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="../functions/edit.htm">
        <tt>
          <b>edit</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../fileio/manedit.htm">
        <tt>
          <b>manedit</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../utilities/unix_g.htm">
        <tt>
          <b>unix_g</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../utilities/unix_s.htm">
        <tt>
          <b>unix_s</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../utilities/unix_w.htm">
        <tt>
          <b>unix_w</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../utilities/unix_x.htm">
        <tt>
          <b>unix_x</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
